<script setup>
import { articleGetChannelService } from "@/api/other/article";
import { ref } from "vue";

defineProps({
  cid: {
    type: [Number, String],
  },
  width: {
    type: String,
  },
});

const emit = defineEmits(["update:cid"]);
const channelList = ref([]);
const getChannelList = async () => {
  const res = await articleGetChannelService();
  channelList.value = res.data.data;
};
getChannelList();
</script>
<template>
  <el-select
    clearable
    :style="{ width }"
    :modelValue="cid"
    @update:cid="emit('update:cid', $event)"
  >
    <el-option
      v-for="channel in channelList"
      :key="channel.id"
      :label="channel.cate_name"
      :value="channel.id"
    ></el-option>
  </el-select>
</template>
